//
//  HPlayListVScroll.m
//  HMusicPlayer
//
//  Created by Hament on 14/9/19.
//  Copyright (c) 2014年 HJ. All rights reserved.
//

#import "HPlayListVScroll.h"
#import "MMDrawingUtils.h"

@implementation HPlayListVScroll



- (void)drawKnob
{
    CGFloat alphaValue;
    
    alphaValue = 0.5 * (float) _animationStep / (float) FRAME_COUNT;
    if ([self bounds].size.width < [self bounds].size.height) {
        [[NSColor colorWithCalibratedWhite:0.0 alpha:alphaValue] setFill];
        NSRect rect = [self rectForPart:NSScrollerKnob];
        rect.size.width = 6;
        rect.origin.x += 0;
        rect.origin.x += 0.0;
        MMFillRoundedRect(rect, 4, 4);
    }
    else {
        // horiz scrollbar
        [[NSColor colorWithCalibratedWhite:0.0 alpha:alphaValue] setFill];
        NSRect rect = [self rectForPart:NSScrollerKnob];
        rect.size.height = 6;
        rect.origin.y += 0;
        rect.origin.y += 6.0;
        MMFillRoundedRect(rect, 4, 4);
    }
}




- (void) drawRect:(NSRect)rect
{
   
    CGContextRef context = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort];
    [[NSColor colorWithCalibratedWhite:0.5 alpha:0.5] setFill];
    CGContextFillRect(context, NSRectToCGRect(rect));
    
    [self drawKnob];
}


@end
